!================================================================
!
! Funzione di Shekel 5 minimi (n=4) 
!
!================================================================
!				VARIABLE BOUNDS
!================================================================
!        0.D0               10.D0          Limits of variable 1
!        0.D0               10.D0             "        "      2
!        0.D0               10.D0			  "        "      3
!        0.D0               10.D0			  "        "      4

SUBROUTINE SHEKEL5(X,N,F)

      IMPLICIT NONE

      INTEGER          :: N
      DOUBLE PRECISION :: X(N), F

      DOUBLE PRECISION :: A(5,4), C(5), FA
      INTEGER          :: I, J

      DO I=1,4
         A(1,I)=4.D0
         A(2,I)=1.D0
         A(3,I)=8.D0
         A(4,I)=6.D0
      END DO
      
      DO I=1,2
         A(5,2*(I-1)+1)=3.D0
         A(5,2*I)=7.D0
      END DO
      
      C(1)=0.1D0
      C(2)=0.2D0
      C(3)=0.2D0
      C(4)=0.4D0
      C(5)=0.4D0

      F  = 0.0D0
      FA = 0.0D0

      DO I=1,5
         DO J=1,4
            FA = FA +(X(J)-A(I,J))**2
         END DO
         IF ((FA+C(I)).EQ.0.D0) THEN
            F=1.D25
            RETURN
         ENDIF
         F = F -1.0D0/(FA+C(I)) 
         FA = 0.0D0
      END DO

	  !F = F  + 10.1531958509790d0
      RETURN

END
